﻿using System.Linq;
using WeChatCardProxy.WebApiEntity;
using ZLWeb.WebApiEntityBase.Cache;
using ZilLion.Service.Core.DapperWrapper;

namespace ZilLion.Service.WeChatCardProxy.Domain
{
    public class Verify_TicketRepository : Respository<Verify_Ticket>, IVerify_TicketRepository
    {
        public Verify_TicketRepository()
        {
            Context = new WeChatCardProxyContext();
        }


        public void InsertVerify_Ticket(Verify_Ticket vticket)
        {
            this.Add(vticket);
        }

        public void UpdateVerify_Ticket(Verify_Ticket vticket)
        {
            this.Modify(vticket);
        }

        public Verify_Ticket GetVerify_Ticket(Verify_Ticket vticket)
        {
           var item= this.GetList("select * from Component_verify_ticket where AppId=@AppId", new {vticket.AppId}).FirstOrDefault();
           return item;
        }

        public Verify_Ticket GetVerify_Ticket(string appid)
        {
            var item = this.GetList("select * from Component_verify_ticket where AppId=@appid", new { appid}).FirstOrDefault();
            return item;
        }

    }
}
